﻿﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- saved from url=(0049)http://localhost:8080/HouseRent/page/register.jsp -->
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>爱家租房 - 用户注册</TITLE>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
  <LINK rel=stylesheet type=text/css href="/css/style.css"/>
  <link rel="script" type="text/html" href="/scripts/jquery.min.1.10.2.js"/>
<META name=GENERATOR content="MSHTML 8.00.7601.17514">
<script src="/scripts/jquery.min.1.10.2.js"></script>
<script type="">

function checkname(e){
var uninput=document.querySelector("[name='name']").parentElement.parentElement;
  if(e==""||e==null){
    $("#err1").display.value="block";
    return;
  }
  if($("#err1").display="block"){
    $("#err1").display="none";
  }
	$.ajax({
		type:"post",
		url:"/user/check?name="+e,
		success:function(obj){
			if(obj.status==false){
				$("#err").html(obj.msg)
			}else{
            }
		}
	})
}
function checkpassword(e){
	var uninput=document.querySelector("[name='password']").parentElement.parentElement;
  if(e==""||e==null){

    $("#err2").display="block";
    return;
  }
  if($("#err2").display="block"){
    $("#err2").display="none";
  }

}
function checkrepassword(e){
	var uninput=document.querySelector("[name='repassword']").parentElement.parentElement;
	var password=document.querySelector("[name='password']");
	if(e==""||e==null){

	$("#err3").display="block";
	return;
	}
  if($("#err3").display="block"){
    $("#err3").display="none";
  }
  if(e!=password.value){
    $("#err3").html="两次输入的密码不一致";
    $("#err3").display="block";

  }

}
function checkphone(e){
  var uninput=document.querySelector("[name='telephone']").parentElement.parentElement;
  if(e==""||e==null){

    $("#err3").display="block";
    return;
  }
  if($("#err3").display="block"){
    $("#err3").display="none";
  }
}
function checkusername(e){
  var uninput=document.querySelector("[name='username']").parentElement.parentElement;
  if(e==""||e==null){

    $("#err4").display="block";
    return;
  }
  if($("#err4").display="block"){
    $("#err4").display="none";
  }
}
function formsubmit() {
      $.ajax({
        type:"post",
        url:"/user/reg.do",
        success: function(obj){
          if($("#err").display="block"){
            $("#err").display="none";
          }
          if(obj.status==false){
            $("#err").html(obj.msg);
            $("#err").display="block";
          }else{
            location.href="login.jsp";
          }

        }
      })
}
</script>
</HEAD>
<BODY>
<DIV id=header class=wrap>
<DIV id=logo><IMG src="/images/logo.gif"></DIV></DIV>
<DIV id=regLogin class=wrap>
<DIV class=dialog>
<DL class=clearfix>
  <DT>新用户注册</DT>
  <DD class=past>填写个人信息</DD></DL>
<DIV class=box>
<FORM action="user/reg.do" method="post">
<DIV class=infos>
<TABLE class=field>
  <TBODY>
<div id="err"  style="color:#ff0000;"></div>
  <TR>
    <TD class=field>用 户 名：</TD>
    <TD><INPUT class=text type=text name="name" onblur="checkname(this.value)"> </TD>
<div id="err1" style='color:red;display:none;'>请输入用户名</div>
</TR>
  <TR>
    <TD class=field>密　　码：</TD>
    <TD><INPUT class=text type=password name="password" onblur="checkpassword(this.value)"></TD>
<div id="err2" style='color:red;display:none;'>请输入密码</div></TR>
  <TR>
    <TD class=field>确认密码：</TD>
    <TD><INPUT class=text type=password name="repassword" onblur="checkrepassword(this.value)"> </TD>
<div id="err3" style='color:red;display:none;'>请再次输入密码</div></TR>
  <TR>
    <TD class=field>电　　话：</TD>
    <TD><INPUT class=text type=text name="telephone" onblur="checkphone(this.value)"> </TD>

<div id="err4" style='color:red;display:none;'>电话为空</div></TR>
  <TR>
    <TD class=field>用户姓名：</TD>
    <TD><INPUT class=text type=text name="username" onblur="checkusername(this.value)"> </TD>

<div id="err5" style='color:red;display:none;'>用户名为空</div></TR></TBODY></TABLE>
<DIV class=buttons>
<INPUT onclick="formsubmit()" value=立即注册 type="submit">
</DIV></DIV>
</FORM>
</DIV></DIV></DIV>
<DIV id=footer class=wrap>
<DL>
  <DT>爱家租房 © 2010 北大爱家 京ICP证1000001号</DT>
  <DD>关于我们 · 联系方式 · 意见反馈 · 帮助中心</DD></DL></DIV></BODY></HTML>
